﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SF.Common;
using System.Collections;
using System.Data;
using System.Configuration;

namespace SF.Web.UI.mallCs
{
    public class index
    {
        public string loaddingUsing(Model.sf_user_info userInfo, string templateType)
        {
            string usingMsg = "";
            if (userInfo != null)
            {
                if (templateType == "weishangred")
                {
                    usingMsg = "<link rel='stylesheet' type='text/css' href='css/index.css' media='all' /><script src='js/scroll.js' type='text/javascript'></script>";
                }
                //Labix：微商城 绿色（目前选择的是这个：微商城单品分销绿色模板）
                else if (templateType == "weishanggreen")
                {
                    usingMsg = "<link rel='stylesheet' type='text/css' href='css/indexgreen.css' media='all' /><script src='js/scroll.js' type='text/javascript'></script>";
                }
                else if (templateType == "syj")
                {
                    usingMsg = "<link rel='stylesheet' type='text/css' href='/mall/css/indexsyj.css' media='all'>";
                }
            }
            return usingMsg;
        }

        public string loaddingJs(Model.sf_user_info userInfo, string templateType)
        {
            string jsMsg = "";
            if (userInfo != null)
            {
                //Labix：微商城 绿色（目前选择的是这个：微商城单品分销绿色模板）
                if (templateType == "weishangred" || templateType == "weishanggreen")
                {
                    jsMsg = "var moreN = 1;var stop = true;$(function () {var totalheight = 0;var bodyheight = 0;$(window).scroll(function () {totalheight = parseFloat($(window).height());bodyheight = parseFloat($('body').height());var scrollheight = parseFloat($(window).scrollTop());if (bodyheight - scrollheight <= totalheight + 10) {if (stop == true) {stop = false;$('#moreMsg').show();$(window).scrollTop(scrollheight + 30);$.get('/tools/user_ajax.ashx', { action: 'get_moregoods', moreNum: moreN, hiddenNum:$('#hiddenGoodsNum').text() }, function (res) {if (res.length > 0) {var temp = res.split('^');var goods = temp[0].substring(0, temp[0].length - 1).split(',');$('#hiddenGoodsNum').text(temp[1]);for (var i = 0; i < goods.length; i++) {var good = goods[i].split('_');var showprice = \"<p class='jx_g_price'><span class='jx_g_price_wx'>统一零售价<span><i>￥</i>\" + good[4] + \"</span>\";if (good[3] != 'maquillage') {showprice = \"<span class='jx_g_price_wx'>惊爆价<span><i>￥</i>\" + good[4] + \"</span></span><del class='jx_g_price_market'>市场价￥\" + good[5] + \"</del>\";}$('.jx_list').append(\"<div class='jx_g'><div class='jx_g_img'><a href='detailed.aspx?id=\" + good[0] + \"' class='J_bi_product_item J_ytag' data-dap='' data-pid='561592'><img class='' src='\" + good[1] + \"'></a></div><div class='jx_g_info'><p class='jx_g_title'><a href='' class='J_bi_product_item J_ytag' data-dap='' data-pid='561592'>\" + good[2] + \"</a></p>\" + showprice + \"</span></p><a href='detailed.aspx?id=\" + good[0] + \"' class='WX_btn jx_g_btn J_bi_product_item J_ytag' data-dap='' data-pid='561592'>立即购买</a></div></div>\");}$('#moreMsg').css('display', 'none');moreN++;stop = true;} else {$('#moreMsg').html('没有更多商品了');setTimeout('hiddenMsg()', 3000);}});}}});});function hiddenMsg() {$('#moreMsg').hide();}$('#menu').click(function () {$('#menulist').toggle();});";
                }
                else if (templateType == "syj")
                {
                    jsMsg = @"function showShareGuide() {
                                  $('#js-share-guide').removeClass('hide');
                              }
                              $(function () {
                                  $('#js-share-guide').click(function () {
                                      $('#js-share-guide').addClass('hide');
                                  });
                              });";
                }
            }
            return jsMsg;
        }

        /// <summary>
        /// Labix：加载商品信息（按Web.config定义的条数取）
        /// </summary>
        /// <param name="userInfo"></param>
        /// <param name="templateType"></param>
        /// <returns></returns>
        public string loaddingHtml(Model.sf_user_info userInfo, string templateType)
        {
            string appWhere = "", htmlMsg = "";
            if (userInfo != null)
            {
                appWhere = Utils.getWhereByInfo(userInfo.busnieseNum, userInfo.appNum, userInfo.templatesNum);

                //若模版为1，使用 奥婕儿 模版   "parent.jsprint(\"" + msgtitle + "\", \"" + url + "\")";
                //1 暂用，后需根据 模版数据  配置在 webconfig中

                //Labix：微商城 绿色（目前选择的是这个：微商城单品分销绿色模板）
                if (templateType == "weishangred" || templateType == "weishanggreen")
                {
                    #region 获取商品信息 html
                    //获取 配置的 商城首页 首次加载商品数 
                    IDictionary dict = ConfigurationManager.GetSection("requestStr") as IDictionary;  //Labix：从Web.config中读取配置项
                    int pageNum = Convert.ToInt32(dict["goodsNum"].ToString());  //Labix：读取每页显示的商品数量
                    //BLL.sf_goods_amounts amountBll = new BLL.sf_goods_amounts();  //Labix：库存Bll（商品库存已写在商品定义中，此处不再另外取值）
                    BLL.bs_good_info goodsBll = new BLL.bs_good_info();  //Labix：商品Bll
                    DataSet ds = goodsBll.GetList(appWhere + " and status='onSale' and stock>0 order by sort");  //Labix：取出目前上架且有库存的商品（onSale表示上架，offSale表示下架）
                    int num = 0;  //Labix：用于跳过多少库存不存在的商品（由于库存不另外取，所以这里不用用到了）
                    string strImg = "", strSerach = "", strGoods = "";
                    //递归商品列表，添加商品信息行
                    for (int i = 0; i < ds.Tables[0].Rows.Count && i < (pageNum + num); i++)
                    {
                        //Labix：如果库存大于0，则显示，由于商品库存已写在商品定义中，此处不再另外判断
                        //if (amountBll.Exists(appWhere + " and goodsNum='" + ds.Tables[0].Rows[i]["goodsNum"] + "'") || Convert.ToInt32(ds.Tables[0].Rows[i]["num"]) > 0)
                        //{
                        //Labix：链接跳转到商品详情页面，图片则显示商品的封面图片
                        strGoods += "<div class='jx_g'><div class='jx_g_img'><a href='detailed.aspx?id=" + ds.Tables[0].Rows[i]["id"] + "' class='J_bi_product_item J_ytag' data-dap='' data-pid='561592'><img class='' src='" + ds.Tables[0].Rows[i]["showImage"] + "'></a></div>";
                        //Labix：显示商品的名称
                        strGoods += "<div class='jx_g_info'><p class='jx_g_title'><a href='' class='J_bi_product_item J_ytag' data-dap='' data-pid='561592'>" + ds.Tables[0].Rows[i]["name"] + "</a></p>";
                        //Labix：如果是单品，则显示统一零售价
                        if (ds.Tables[0].Rows[i]["typeNum"].ToString() == "maquillage")
                        {
                            strGoods += "<p class='jx_g_price'><span class='jx_g_price_wx'>统一零售价<span><i>￥</i>" + ds.Tables[0].Rows[i]["sellPrice"] + "</span>";
                            //strGoods += "<p class='jx_g_price'><span class='jx_g_price_wx'>惊爆价<span><i>￥</i>" + ds.Tables[0].Rows[i]["sellPrice"] + "</span><del class='jx_g_price_market'>市场价￥" + ds.Tables[0].Rows[i]["deletePrice"] + "</del>";
                        }
                        else
                        {
                            strGoods += "<p class='jx_g_price'><span class='jx_g_price_wx'>惊爆价<span><i>￥</i>" + ds.Tables[0].Rows[i]["sellPrice"] + "</span><del class='jx_g_price_market'>市场价￥" + ds.Tables[0].Rows[i]["deletePrice"] + "</del>";
                        }
                        strGoods += "</span></p><a href='detailed.aspx?id=" + ds.Tables[0].Rows[i]["id"] + "' class='WX_btn jx_g_btn J_bi_product_item J_ytag' data-dap='' data-pid='561592'>立即购买</a></div></div>";
                        //}
                        //else
                        //{
                        //    num++;  //Labix：如果没库存，则num递增，用于跳过没库存的商品
                        //}
                    }
                    #endregion

                    #region 绑定商品类型 -- 前1级 html
                    BLL.bs_good_type typeBll = new BLL.bs_good_type();  //Labix：商品分类Bll
                    DataTable dt = typeBll.GetList(0, appWhere, 1);  //Labix：获得所有类别列表（仅查询到1级）
                    //Labix：递归一级商品类别
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        //Labix：跳转到商品列表页面（注意：原来传参数typeNum已经修改为传id，goodList页面要注意同步更改）
                        strSerach += "<a href='goodList.aspx?id=" + dt.Rows[i]["id"] + "' class='J_ytag WX_cat_sp' href='" + dt.Rows[i]["id"] + "'>" + dt.Rows[i]["typeName"] + "</a>";
                    }
                    #endregion

                    #region 绑定设置活动图片 html
                    //Labix：商城配置-商城活动图片中设置此项
                    BLL.sf_goods_index_pics indexBll = new BLL.sf_goods_index_pics();
                    DataSet df = indexBll.GetList(5, "isShow=1 and " + appWhere, "sort");
                    for (int i = 0; i < df.Tables[0].Rows.Count; i++)
                    {
                        strImg += "<li data-index='0' style='width: 640px; left: 0px; transition: all 300ms ease 0s; transform: translateX(-640px);'><a target='_top' title='" + df.Tables[0].Rows[i]["titles"].ToString() + "'><img alt='" + df.Tables[0].Rows[i]["titles"].ToString() + "' class='pp_init_img' src='" + df.Tables[0].Rows[i]["pics"].ToString() + "'></a></li>";
                    }
                    #endregion

                    //Labix：页面顶部和底部的固定菜单项（我的订单、商品分类、购物车、会员中心）
                    htmlMsg = @"<body id='Body1' runat='server'><form id='Form1' runat='server'>
<!--topbar begin-->
<section class='box' id='myorder'>
    <div class='user_index'>
        <div class='user_header' id='actionBar'>
            <span><a href='/mall/cart.aspx' class='shopping-cart'><i class='fa fa-shopping-cart'></i></a></span>
            <span><a href='/mall/orderList.aspx?payStatus=ToPay'>我的订单</a></span>
        </div>
    </div>
</section>
<span id='hiddenGoodsNum' style='display:none;'>" + num + @"</span>
<section class='box' id='banner'><div class='pfhlkd_frame1'>
    <div class='pfhlkd_mode0  pfhlkd_mf10001000'></div>
    <div class='pfhlkd_mode0  pfhlkd_mf10001005'></div>
    <div class='pfhlkd_mode0  pfhlkd_mf10001001'>
        <div class='bd pfhlkd_bd_10'>
            <div class='shop_slider shop_slider_auto mod_pic_mt_1' data-tag='module-slider' data-height='320'>
                <div class='inner' data-tag='slider-warp' style='visibility: visible;'>
                    <ul class='pic_list' data-tag='slider-list' style='width: 1920px;'>" + strImg + @"</ul>
                </div><div class='bar_wrap'><ul class='bar' data-tag='slider-page'><li class=''></li><li class='cur'></li><li class=''></li></ul></div></div></div></div></div></section>
<section class='box' id='module'><div><div class='user_nav clearfix'><ul class='user_nav_list'>
<li class='pro-class'><a href='javascript:void(0)' id='menu' class='icon-s1'>
<span class='fa fa-th'></span>商品分类</a><div class='WX_cat_pop WX_cat_list J_smenu_list' id='menulist' style='display:none;'><i class='WX_cat_btn-arrow'></i>" + strSerach + @"</div></li>
<li><a href='goodList.aspx?goodHot=newGood' class='icon-s1'><span class='fa fa-clock-o'></span>新品上架</a></li>
<li><a href='goodList.aspx?goodHot=choiceGood' class='icon-s1'><span class='fa fa-heart'></span>精选商品</a></li>
<li><a href='goodList.aspx?goodHot=preferentialGood' class='icon-s1'><span class='fa fa-tags'></span>特惠商品</a></li></ul></div></div></section>
<div style='clear: both;'></div><div class='h30' id='h30' style='display: none;'></div><div class='WX_con' id='J_main'>
<div class='jx'><div class='jx_list'>" + strGoods + @"</div></div></div>
<div id='moreMsg' style='height:20px;text-align:center;display:none;'>正在加载...</div>
<div class='h50'></div><div class='fixed bottom'><dl class='sub-nav nav-b3'><dd class='active'><a href='javascript:void(0)'>
<i class='icon-store'></i>逛商城</a></dd><dd><a href='/mall/cart.aspx'><i class='icon-distribusion'></i>购物车</a></dd>
<dd><a href='/mall/user.aspx'><i class='icon-member'></i>会员中心</a></dd></dl></div></form></body>";
                }
                else if (templateType == "syj")
                {
                    //模板数据接口                    
                    //商城活动
                    BLL.sf_goods_index_pics indexBll = new BLL.sf_goods_index_pics();
                    DataSet dsGoodsActive = indexBll.GetList(4, "isShow=1 and " + appWhere, "sort");

                    //商品类型
                    BLL.sf_goods_types typeBll = new BLL.sf_goods_types();
                    DataTable dtGoodsType = typeBll.GetList(0, appWhere, 1);

                    //新品上架
                    BLL.sf_goods_info goodsBll = new BLL.sf_goods_info();
                    DataSet dsGoodsNew = goodsBll.GetList(10, "ishot=1 and status=1 and " + appWhere, " sort");

                    //精选商品
                    DataSet dsGoodsChoice = goodsBll.GetList(10, "ishot=2 and status=1 and " + appWhere, "sort");

                    //特惠商品
                    DataSet dsGoodsPreferential = goodsBll.GetList(4, "ishot=3 and status=1 and " + appWhere, " sort");

                    StringBuilder sbBody = new StringBuilder();
                    sbBody.AppendLine("    <body class='body-fixed-bottom'>");
                    sbBody.AppendLine("        <div style='min-height: 641px;' class='container '>");
                    sbBody.AppendLine("            <div class='header'>");
                    sbBody.AppendLine("            </div>");
                    sbBody.AppendLine("            <div class='content '>");
                    sbBody.AppendLine("                <div class='content-body js-page-content' data-page-position='homepage'>");
                    sbBody.AppendLine("");

                    //模板标题
                    sbBody.AppendLine("                    <!-- 店铺主页模板 - 微小店 -->");
                    sbBody.AppendLine("                    <div class='tpl-wxd'>");
                    sbBody.AppendLine("                        <div class='tpl-wxd-header' style='background-image: url(http://dn-kdt-img.qbox.me/upload_files/2015/05/27/Fuugh17gQJOOE9ibnmRp-XsVozq1.jpg);'>");
                    sbBody.AppendLine("                            <div class='tpl-wxd-title'>");
                    sbBody.AppendLine("                                " + userInfo.nickName + "");
                    sbBody.AppendLine("                            </div>");
                    sbBody.AppendLine("                            <div class='tpl-wxd-avatar'>");
                    sbBody.AppendLine("                                <img src='" + userInfo.photoUri + "' alt='头像'>");
                    sbBody.AppendLine("                            </div>");
                    sbBody.AppendLine("                        </div>");
                    sbBody.AppendLine("                    </div>");
                    sbBody.AppendLine("");

                    //商城目录
                    sbBody.AppendLine("                    <!-- 4列广告 -->");
                    sbBody.AppendLine("                    <ul class='custom-nav-4 clearfix'>");
                    sbBody.AppendLine("                        <li>");
                    sbBody.AppendLine("                            <a href='goodList.aspx'>");
                    sbBody.AppendLine("                                <span class='nav-img-wap'>");
                    sbBody.AppendLine("                                    <img src='http://dn-kdt-img.qbox.me/upload_files/2015/03/03/Fl-ezr-CBVDq1YYh2tmOW1zYkO3s.jpg?imageView2/2/w/280/h/280/q/75/format/jpg'");
                    sbBody.AppendLine("                                    style='display: inline;' class='js-lazy' data-src='http://dn-kdt-img.qbox.me/upload_files/2015/03/03/Fl-ezr-CBVDq1YYh2tmOW1zYkO3s.jpg!140x140+2x.jpg'>");
                    sbBody.AppendLine("                                </span>");
                    sbBody.AppendLine("                                <span class='title'>");
                    sbBody.AppendLine("                                    全部商品");
                    sbBody.AppendLine("                                </span>");
                    sbBody.AppendLine("                            </a>");
                    sbBody.AppendLine("                        </li>");
                    sbBody.AppendLine("                        <li>");
                    sbBody.AppendLine("                            <a href='goodList.aspx?ishot=1'>");
                    sbBody.AppendLine("                                <span class='nav-img-wap'>");
                    sbBody.AppendLine("                                    <img src='http://dn-kdt-img.qbox.me/upload_files/2015/03/03/Fm9T7H9y6k1JOCN6mGQojFovvvoD.jpg?imageView2/2/w/280/h/280/q/75/format/jpg'");
                    sbBody.AppendLine("                                    style='display: inline;' class='js-lazy' data-src='http://dn-kdt-img.qbox.me/upload_files/2015/03/03/Fm9T7H9y6k1JOCN6mGQojFovvvoD.jpg!140x140+2x.jpg'>");
                    sbBody.AppendLine("                                </span>");
                    sbBody.AppendLine("                                <span class='title'>");
                    sbBody.AppendLine("                                    新品上架");
                    sbBody.AppendLine("                                </span>");
                    sbBody.AppendLine("                            </a>");
                    sbBody.AppendLine("                        </li>");
                    sbBody.AppendLine("                        <li>");
                    sbBody.AppendLine("                            <a href='goodList.aspx?ishot=2'>");
                    sbBody.AppendLine("                                <span class='nav-img-wap'>");
                    sbBody.AppendLine("                                    <img src='http://dn-kdt-img.qbox.me/upload_files/2015/03/03/FvNPkXPp12Xg5eqtHIjU8mIACK1b.jpg?imageView2/2/w/280/h/280/q/75/format/jpg'");
                    sbBody.AppendLine("                                    style='display: inline;' class='js-lazy' data-src='http://dn-kdt-img.qbox.me/upload_files/2015/03/03/FvNPkXPp12Xg5eqtHIjU8mIACK1b.jpg!140x140+2x.jpg'>");
                    sbBody.AppendLine("                                </span>");
                    sbBody.AppendLine("                                <span class='title'>");
                    sbBody.AppendLine("                                    精选商品");
                    sbBody.AppendLine("                                </span>");
                    sbBody.AppendLine("                            </a>");
                    sbBody.AppendLine("                        </li>");
                    sbBody.AppendLine("                        <li>");
                    sbBody.AppendLine("                            <a href='goodList.aspx?ishot=3'>");
                    sbBody.AppendLine("                                <span class='nav-img-wap'>");
                    sbBody.AppendLine("                                    <img src='http://dn-kdt-img.qbox.me/upload_files/2015/03/03/Fje-VhFiGI95Ck3BG1LhLhw0RvXO.jpg?imageView2/2/w/280/h/280/q/75/format/jpg'");
                    sbBody.AppendLine("                                    style='display: inline;' class='js-lazy' data-src='http://dn-kdt-img.qbox.me/upload_files/2015/03/03/Fje-VhFiGI95Ck3BG1LhLhw0RvXO.jpg!140x140+2x.jpg'>");
                    sbBody.AppendLine("                                </span>");
                    sbBody.AppendLine("                                <span class='title'>");
                    sbBody.AppendLine("                                    特惠商品");
                    sbBody.AppendLine("                                </span>");
                    sbBody.AppendLine("                            </a>");
                    sbBody.AppendLine("                        </li>");
                    sbBody.AppendLine("                    </ul>");

                    //特惠商品(v1.0)
                    //sbBody.AppendLine("                    <!-- 4列广告 -->");
                    //sbBody.AppendLine("                    <ul class='custom-nav-4 clearfix'>");

                    //foreach (System.Data.DataRow r in dsGoodsPreferential.Tables[0].Rows)
                    //{
                    //    string goodsId = r["id"].ToString();
                    //    string title = r["names"].ToString();
                    //    string imgUrl = r["showImgs"].ToString();

                    //    sbBody.AppendLine("                        <li>");
                    //    sbBody.AppendLine("                            <a href='detailed.aspx?id=" + goodsId + "'>");
                    //    sbBody.AppendLine("                                <span class='nav-img-wap'>");
                    //    sbBody.AppendLine("                                    <img src='"+imgUrl+"'");
                    //    sbBody.AppendLine("                                    style='display: inline;' class='js-lazy' data-src='"+imgUrl+"'>");
                    //    sbBody.AppendLine("                                </span>");
                    //    sbBody.AppendLine("                                <span class='title'>");
                    //    sbBody.AppendLine("                                    "+title+"");
                    //    sbBody.AppendLine("                                </span>");
                    //    sbBody.AppendLine("                            </a>");
                    //    sbBody.AppendLine("                        </li>");
                    //}
                    //sbBody.AppendLine("                    </ul>");
                    //sbBody.AppendLine("");



                    ////商品目录(商品分类，新品上架，精选商品，特惠商品)
                    //sbBody.AppendLine("                    <!-- 4列广告 -->");
                    //sbBody.AppendLine("                    <ul class='custom-nav-4 clearfix'>");
                    //sbBody.AppendLine("                        <li>");
                    //sbBody.AppendLine("                            <a href='javascript:void(0);' id='menu' >");
                    //sbBody.AppendLine("                                <span class='nav-img-wap'>");
                    //sbBody.AppendLine("                                    <img src='http://dn-kdt-img.qbox.me/upload_files/2015/03/03/FsHenP-XDaGP57Imdf0_A8JsJTOM.jpg?imageView2/2/w/280/h/280/q/75/format/jpg'");
                    //sbBody.AppendLine("                                    style='display: inline;' class='js-lazy' data-src='http://dn-kdt-img.qbox.me/upload_files/2015/03/03/FsHenP-XDaGP57Imdf0_A8JsJTOM.jpg!140x140+2x.jpg'>");
                    //sbBody.AppendLine("                                </span>");
                    //sbBody.AppendLine("                            </a>");
                    //sbBody.AppendLine("                        </li>");
                    //sbBody.AppendLine("                        <li>");
                    //sbBody.AppendLine("                            <a href='goodList.aspx?ishot=1'>");
                    //sbBody.AppendLine("                                <span class='nav-img-wap'>");
                    //sbBody.AppendLine("                                    <img src='http://dn-kdt-img.qbox.me/upload_files/2015/03/03/FsHenP-XDaGP57Imdf0_A8JsJTOM.jpg?imageView2/2/w/280/h/280/q/75/format/jpg'");
                    //sbBody.AppendLine("                                    style='display: inline;' class='js-lazy' data-src='http://dn-kdt-img.qbox.me/upload_files/2015/03/03/Fm1ZlVgMs00hdxNezQwwEigtRrn-.jpg!140x140+2x.jpg'>");
                    //sbBody.AppendLine("                                </span>");
                    //sbBody.AppendLine("                            </a>");
                    //sbBody.AppendLine("                        </li>");
                    //sbBody.AppendLine("                        <li>");
                    //sbBody.AppendLine("                            <a href='goodList.aspx?ishot=2'>");
                    //sbBody.AppendLine("                                <span class='nav-img-wap'>");
                    //sbBody.AppendLine("                                    <img src='http://dn-kdt-img.qbox.me/upload_files/2015/03/03/Frtra6oPIvq1XmyEq78s9ehY4o3K.jpg?imageView2/2/w/280/h/280/q/75/format/jpg'");
                    //sbBody.AppendLine("                                    style='display: inline;' class='js-lazy' data-src='http://dn-kdt-img.qbox.me/upload_files/2015/03/03/Frtra6oPIvq1XmyEq78s9ehY4o3K.jpg!140x140+2x.jpg'>");
                    //sbBody.AppendLine("                                </span>");
                    //sbBody.AppendLine("                            </a>");
                    //sbBody.AppendLine("                        </li>");
                    //sbBody.AppendLine("                        <li>");
                    //sbBody.AppendLine("                            <a href='goodList.aspx?ishot=3'>");

                    //sbBody.AppendLine("                                <span class='nav-img-wap'>");
                    //sbBody.AppendLine("                                    <img src='http://dn-kdt-img.qbox.me/upload_files/2015/03/03/Frtra6oPIvq1XmyEq78s9ehY4o3K.jpg?imageView2/2/w/280/h/280/q/75/format/jpg'");
                    //sbBody.AppendLine("                                    style='display: inline;' class='js-lazy' data-src='http://dn-kdt-img.qbox.me/upload_files/2015/03/03/Frtra6oPIvq1XmyEq78s9ehY4o3K.jpg!140x140+2x.jpg'>");
                    //sbBody.AppendLine("                                </span>");

                    //sbBody.AppendLine("                            </a>");
                    //sbBody.AppendLine("                        </li>");
                    //sbBody.AppendLine("                    </ul>");
                    //sbBody.AppendLine("");


                    //商品类型
                    sbBody.AppendLine("                    <div class='WX_cat_pop WX_cat_list J_smenu_list' id='menulist' style='display:none;'><i class='WX_cat_btn-arrow'></i>");
                    foreach (System.Data.DataRow r in dtGoodsType.Rows)
                    {
                        sbBody.AppendLine("                     <a href='goodList.aspx?id=" + r["id"] + "' class='J_ytag WX_cat_sp' href='" + r["typeNum"] + "'>" + r["name"] + "</a>");
                    }
                    sbBody.AppendLine("                    </div>");

                    //新品上架(3个商品一组显示,分为一大两小)
                    sbBody.AppendLine("                    <ul class='js-goods-list sc-goods-list pic clearfix size-2 ' data-size='2'");
                    sbBody.AppendLine("                    data-showtype='card' style='visibility: visible;'>");
                    sbBody.AppendLine("                        <!-- 商品区域 -->");
                    sbBody.AppendLine("                        <!-- 展现类型判断 -->");

                    for (int i = 0; i < dsGoodsNew.Tables[0].Rows.Count; i++)
                    {
                        string styleClass = (i) % 3 == 0 ? "big-pic" : "small-pic";
                        string styleHeight = (i) % 3 == 0 ? "height: 346px;" : "";

                        string goodsName = dsGoodsNew.Tables[0].Rows[i]["names"].ToString();
                        string goodsId = dsGoodsNew.Tables[0].Rows[i]["id"].ToString();
                        string goodsImgUrl = dsGoodsNew.Tables[0].Rows[i]["showImgs"].ToString();
                        string goodsSalesPrice = dsGoodsNew.Tables[0].Rows[i]["salesPrice"].ToString();
                        string goodsShowPrice = dsGoodsNew.Tables[0].Rows[i]["showPrice"].ToString();

                        sbBody.AppendLine("                        <li class='js-goods-card goods-card " + styleClass + " card '>");
                        sbBody.AppendLine("                            <a href='detailed.aspx?id=" + goodsId + "' class='js-goods link clearfix'");
                        sbBody.AppendLine("                            target='_top' data-goods-id='" + goodsId + "' title='" + goodsName + " '>");
                        sbBody.AppendLine("                                <div style='" + styleHeight + " background-color: rgb(255, 255, 255);' class='photo-block'");
                        sbBody.AppendLine("                                data-width='430' data-height='430'>");
                        sbBody.AppendLine("                                    <img src='" + goodsImgUrl + "'");
                        sbBody.AppendLine("                                    style='display: inline;' class='goods-photo js-goods-lazy' data-src='" + goodsImgUrl + "'>");
                        sbBody.AppendLine("                                </div>");
                        sbBody.AppendLine("                                <div class='info clearfix info-no-title info-price btn3'>");
                        sbBody.AppendLine("                                    <p class=' goods-title '>");
                        sbBody.AppendLine("                                        " + goodsName);
                        sbBody.AppendLine("                                    </p>");
                        sbBody.AppendLine("                                    <p class='goods-sub-title c-black hide'>");
                        sbBody.AppendLine("                                    </p>");
                        sbBody.AppendLine("                                    <p class='goods-price'>");
                        sbBody.AppendLine("                                        <em>");
                        sbBody.AppendLine("                                            ￥" + goodsSalesPrice + "");
                        sbBody.AppendLine("                                        </em>");
                        sbBody.AppendLine("                                    </p>");
                        sbBody.AppendLine("                                    <p class='goods-price-taobao '>");
                        sbBody.AppendLine("                                        市场价：￥" + goodsShowPrice + "");
                        sbBody.AppendLine("                                    </p>");
                        sbBody.AppendLine("                                </div>");
                        sbBody.AppendLine("                                <div class='goods-buy btn3 info-no-title'>");
                        sbBody.AppendLine("                                </div>");
                        sbBody.AppendLine("                                <div class='js-goods-buy buy-response' data-alias='t8wvq3sa' data-postage='0'");
                        sbBody.AppendLine("                                data-buyway='1' data-id='" + goodsId + "' data-title='" + goodsName + " ' data-price='" + goodsSalesPrice + "'");
                        sbBody.AppendLine("                                data-isvirtual='0'>");
                        sbBody.AppendLine("                                </div>");
                        sbBody.AppendLine("                            </a>");
                        sbBody.AppendLine("                        </li>");
                    }
                    sbBody.AppendLine("                    </ul>");
                    sbBody.AppendLine("");

                    //精选商品
                    sbBody.AppendLine("                    <ul class='js-goods-list sc-goods-list pic clearfix size-1 waterfall'");
                    sbBody.AppendLine("                    data-size='1' data-showtype='waterfall' style='visibility: visible;'>");
                    sbBody.AppendLine("                        <!-- 商品区域 -->");
                    sbBody.AppendLine("                        <!-- 展现类型判断 -->");
                    foreach (System.Data.DataRow r in dsGoodsChoice.Tables[0].Rows)
                    {
                        string goodsName = r["names"].ToString();
                        string goodsId = r["id"].ToString();
                        string goodsImgUrl = r["showImgs"].ToString();
                        string goodsSalesPrice = r["salesPrice"].ToString();
                        string goodsShowPrice = r["showPrice"].ToString();


                        sbBody.AppendLine("                        <li style='float: left; z-index: 3; width: 176.5px;' class=''>");
                        sbBody.AppendLine("                            <li class='js-goods-card goods-card small-pic waterfall '>");
                        sbBody.AppendLine("                                <a href='detailed.aspx?id=" + goodsId + "' class='js-goods link clearfix'");
                        sbBody.AppendLine("                                target='_top' data-goods-id='" + goodsId + "' title='" + goodsName + "'>");
                        sbBody.AppendLine("                                    <div class='photo-block' data-width='800' data-height='800'>");
                        sbBody.AppendLine("                                        <img class='goods-photo js-goods-lazy' data-src='" + goodsImgUrl + "'>");
                        sbBody.AppendLine("                                    </div>");
                        sbBody.AppendLine("                                    <div class='info clearfix info-no-title info-price btn3'>");
                        sbBody.AppendLine("                                        <p class=' goods-title '>");
                        sbBody.AppendLine("                                            " + goodsName + "");
                        sbBody.AppendLine("                                        </p>");
                        sbBody.AppendLine("                                        <p class='goods-sub-title c-black hide'>");
                        sbBody.AppendLine("                                        </p>");
                        sbBody.AppendLine("                                        <p class='goods-price'>");
                        sbBody.AppendLine("                                            <em>");
                        sbBody.AppendLine("                                                ￥" + goodsSalesPrice + "");
                        sbBody.AppendLine("                                            </em>");
                        sbBody.AppendLine("                                        </p>");
                        sbBody.AppendLine("                                        <p class='goods-price-taobao  hide'>");
                        sbBody.AppendLine("                                        </p>");
                        sbBody.AppendLine("                                    </div>");
                        sbBody.AppendLine("                                    <div class='goods-buy btn3 info-no-title'>");
                        sbBody.AppendLine("                                    </div>");
                        sbBody.AppendLine("                                    <div class='js-goods-buy buy-response' data-alias='3qwfqnt7' data-postage='0'");
                        sbBody.AppendLine("                                    data-buyway='1' data-id='" + goodsId + "' data-title='" + goodsName + "'");
                        sbBody.AppendLine("                                    data-price='" + goodsSalesPrice + "' data-isvirtual='0'>");
                        sbBody.AppendLine("                                    </div>");
                        sbBody.AppendLine("                                </a>");
                        sbBody.AppendLine("                            </li>");
                    }

                    sbBody.AppendLine("                    </ul>");
                    sbBody.AppendLine("");

                    //导航
                    //sbBody.AppendLine("                    <!-- 分类 -->");
                    //sbBody.AppendLine("                    <div class='custom-category'>");
                    //sbBody.AppendLine("                        <ul class='clearfix'>");
                    //sbBody.AppendLine("                            <li>");
                    //sbBody.AppendLine("                                <a href='http://wap.koudaitong.com/v2/showcase/homepage?alias=5pr5d5'>");
                    //sbBody.AppendLine("                                    返回上一层");
                    //sbBody.AppendLine("                                </a>");
                    //sbBody.AppendLine("                            </li>");
                    //sbBody.AppendLine("                            <li>");
                    //sbBody.AppendLine("                                <a href='http://wap.koudaitong.com/v2/showcase/usercenter?alias=wbocun'>");
                    //sbBody.AppendLine("                                    我的购物车");
                    //sbBody.AppendLine("                                </a>");
                    //sbBody.AppendLine("                            </li>");
                    //sbBody.AppendLine("                            <li>");
                    //sbBody.AppendLine("                                <a href='http://wap.koudaitong.com/v2/showcase/feature?alias=w6u76st1'>");
                    //sbBody.AppendLine("                                    积分商城");
                    //sbBody.AppendLine("                                </a>");
                    //sbBody.AppendLine("                            </li>");
                    //sbBody.AppendLine("                            <li>");
                    //sbBody.AppendLine("                                <a href='http://wap.koudaitong.com/v2/showcase/usercenter?alias=wbocun'>");
                    //sbBody.AppendLine("                                    我的积分");
                    //sbBody.AppendLine("                                </a>");
                    //sbBody.AppendLine("                            </li>");
                    //sbBody.AppendLine("                        </ul>");
                    //sbBody.AppendLine("                    </div>");
                    //sbBody.AppendLine("");
                    //sbBody.AppendLine("                    <div class='custom-store block-item border'>");
                    //sbBody.AppendLine("                        <a class='custom-store-link clearfix' href='http://sedate.koudaitong.com/'>");
                    //sbBody.AppendLine("                            <div class='custom-store-img'>");
                    //sbBody.AppendLine("                            </div>");
                    //sbBody.AppendLine("                            <div class='custom-store-name'>");
                    //sbBody.AppendLine("                                sedate旗舰店");
                    //sbBody.AppendLine("                            </div>");
                    //sbBody.AppendLine("                            <span class='custom-store-enter'>");
                    //sbBody.AppendLine("                                进入店铺");
                    //sbBody.AppendLine("                            </span>");
                    //sbBody.AppendLine("                        </a>");
                    //sbBody.AppendLine("                    </div>");
                    //sbBody.AppendLine("");

                    //商城统一的推销广告
                    sbBody.AppendLine("                    <!-- 图片广告 -->");
                    sbBody.AppendLine("                    <div class='custom-image-swiper js-swp swp'>");
                    sbBody.AppendLine("                        <div class='swiper-wrapper js-swp-wrap js-view-image-list' style='height: 150px;'");
                    sbBody.AppendLine("                        data-height='175'>");
                    sbBody.AppendLine("                            <a style='position: absolute; top: 0px; left: 0px; width: 100%; height: 100%; display: block;'");
                    sbBody.AppendLine("                            class='swp-page' href='javascript:void(0);' target='_top'>");
                    sbBody.AppendLine("                                <img src='http://dn-kdt-img.qbox.me/upload_files/2014/09/13/FqIDRUI86-0FUnWw_twlrw_wX7nD.jpg?imageView2/2/w/730/h/0/q/75/format/jpg'");
                    sbBody.AppendLine("                                class='js-res-load js-view-image-item' data-src='http://dn-kdt-img.qbox.me/upload_files/2014/09/13/FqIDRUI86-0FUnWw_twlrw_wX7nD.jpg!730x0.jpg'>");
                    sbBody.AppendLine("                            </a>");
                    sbBody.AppendLine("                        </div>");
                    sbBody.AppendLine("                        <div class='swiper-pagination js-swiper-pagination'>");
                    sbBody.AppendLine("                            <ul class='swp-thumbnail-list'>");
                    sbBody.AppendLine("                                <li class='swiper-pagination-switch swiper-active-switch'>");
                    sbBody.AppendLine("                                </li>");
                    sbBody.AppendLine("                                <li class='swiper-pagination-switch'>");
                    sbBody.AppendLine("                                </li>");
                    sbBody.AppendLine("                            </ul>");
                    sbBody.AppendLine("                        </div>");
                    sbBody.AppendLine("                    </div>");
                    sbBody.AppendLine("");
                    sbBody.AppendLine("                </div>");
                    sbBody.AppendLine("");
                    sbBody.AppendLine("");

                    //商城微信号（仅在电脑版本预览商城的时候显示）
                    //sbBody.AppendLine("                <div class='content-sidebar'>");
                    //sbBody.AppendLine("                    <a href='http://wap.koudaitong.com/v2/showcase/homepage?kdt_id=384' class='link'>");
                    //sbBody.AppendLine("                        <div class='sidebar-section shop-card'>");
                    //sbBody.AppendLine("                            <div class='table-cell'>");
                    //sbBody.AppendLine("                                <img src='http://dn-kdt-img.qbox.me/upload_files/2014/10/24/FvHPw_vQ3zBkkOhp27evzYfCKtxw.png!60x60+2x.jpg'");
                    //sbBody.AppendLine("                                class='shop-img' alt='公众号头像' height='60' width='60'>");
                    //sbBody.AppendLine("                            </div>");
                    //sbBody.AppendLine("                            <div class='table-cell'>");
                    //sbBody.AppendLine("                                <p class='shop-name'>");
                    //sbBody.AppendLine("                                    水云间shuiyunjian微商城");
                    //sbBody.AppendLine("                                </p>");
                    //sbBody.AppendLine("                            </div>");
                    //sbBody.AppendLine("                        </div>");
                    //sbBody.AppendLine("                    </a>");
                    //sbBody.AppendLine("                    <div class='sidebar-section shop-info'>");
                    //sbBody.AppendLine("                        <div class='section-detail'>");
                    //sbBody.AppendLine("                            <p class='text-center weixin-title'>");
                    //sbBody.AppendLine("                                微信“扫一扫”立即关注");
                    //sbBody.AppendLine("                            </p>");
                    //sbBody.AppendLine("                            <div class='text-center qr-code'>");
                    //sbBody.AppendLine("                                <img src='http://open.weixin.qq.com/qr/code/?username=sedatetmall' height='158'");
                    //sbBody.AppendLine("                                width='158'>");
                    //sbBody.AppendLine("                            </div>");
                    //sbBody.AppendLine("                            <p class='text-center weixin-no'>");
                    //sbBody.AppendLine("                                微信号：sedatetmall");
                    //sbBody.AppendLine("                            </p>");
                    //sbBody.AppendLine("                        </div>");
                    //sbBody.AppendLine("                    </div>");
                    //sbBody.AppendLine("                </div>");
                    //sbBody.AppendLine("");

                    //页面固定菜单内容
                    sbBody.AppendLine("                <div style='display: block;' id='shop-nav'>");
                    sbBody.AppendLine("                    <div class='js-navmenu js-footer-auto-ele shop-nav nav-menu nav-menu-1 has-menu-3'>");
                    sbBody.AppendLine("                        <div class='nav-special-item nav-item'>");
                    sbBody.AppendLine("                            <a href='index.aspx?appnum=" + userInfo.appNum + "' class='home'>");
                    sbBody.AppendLine("                                主页");
                    sbBody.AppendLine("                            </a>");
                    sbBody.AppendLine("                        </div>");
                    sbBody.AppendLine("                        <div class='nav-item'>");
                    sbBody.AppendLine("                            <a class='mainmenu js-mainmenu' href='/mall/cart.aspx'>");
                    sbBody.AppendLine("                                <i class='arrow-weixin'>");
                    sbBody.AppendLine("                                </i>");
                    sbBody.AppendLine("                                <span class='mainmenu-txt'>");
                    sbBody.AppendLine("                                    购物车");
                    sbBody.AppendLine("                                </span>");
                    sbBody.AppendLine("                            </a>");
                    sbBody.AppendLine("                        </div>");
                    sbBody.AppendLine("                        <div class='nav-item'>");
                    sbBody.AppendLine("                            <a class='mainmenu js-mainmenu' href='/mall/user.aspx'>");
                    sbBody.AppendLine("                                <i class='arrow-weixin'>");
                    sbBody.AppendLine("                                </i>");
                    sbBody.AppendLine("                                <span class='mainmenu-txt'>");
                    sbBody.AppendLine("                                    会员中心");
                    sbBody.AppendLine("                                </span>");
                    sbBody.AppendLine("                            </a>");
                    sbBody.AppendLine("                            <!-- 子菜单 -->");
                    sbBody.AppendLine("                            <div class='submenu js-submenu'>");
                    sbBody.AppendLine("                                <span class='arrow before-arrow'>");
                    sbBody.AppendLine("                                </span>");
                    sbBody.AppendLine("                                <span class='arrow after-arrow'>");
                    sbBody.AppendLine("                                </span>");
                    sbBody.AppendLine("                                <ul>");
                    sbBody.AppendLine("                                    <li>");
                    sbBody.AppendLine("                                        <a href='http://wap.koudaitong.com/v2/feature/6n8o0l1b'>");
                    sbBody.AppendLine("                                            积分兑换");
                    sbBody.AppendLine("                                        </a>");
                    sbBody.AppendLine("                                    </li>");
                    sbBody.AppendLine("                                </ul>");
                    sbBody.AppendLine("                            </div>");
                    sbBody.AppendLine("                        </div>");
                    sbBody.AppendLine("                    </div>");
                    sbBody.AppendLine("                </div>");
                    sbBody.AppendLine("            </div>");
                    sbBody.AppendLine("        </div>");
                    sbBody.AppendLine("");

                    //页脚内容
                    sbBody.AppendLine("        <div class='js-footer' style='min-height: 1px;'>");
                    sbBody.AppendLine("            <div>");
                    sbBody.AppendLine("                <div class='footer'>");
                    sbBody.AppendLine("                    <div class='copyright'>");
                    sbBody.AppendLine("                        <div class='ft-links'>");
                    sbBody.AppendLine("                            <a href='index.aspx?appnum=" + userInfo.appNum + "' target='_top'>");
                    sbBody.AppendLine("                                店铺主页");
                    sbBody.AppendLine("                            </a>");
                    sbBody.AppendLine("                            <a href='user.aspx'");
                    sbBody.AppendLine("                            target='_top'>");
                    sbBody.AppendLine("                                会员中心");
                    sbBody.AppendLine("                            </a>");
                    sbBody.AppendLine("                            <a href='javascript:showShareGuide();' class='js-open-follow'>");
                    sbBody.AppendLine("                                关注我们");
                    sbBody.AppendLine("                            </a>");
                    sbBody.AppendLine("                        </div>");
                    sbBody.AppendLine("                        <div class='ft-copyright'>");
                    sbBody.AppendLine("                            <a href='/door/index.aspx' target='_top'>");
                    sbBody.AppendLine("                                微信提供技术支持");
                    sbBody.AppendLine("                            </a>");
                    sbBody.AppendLine("                        </div>");
                    sbBody.AppendLine("                    </div>");
                    sbBody.AppendLine("                </div>");
                    sbBody.AppendLine("            </div>");
                    sbBody.AppendLine("        </div>");
                    sbBody.AppendLine("");

                    //关注链接（显示遮罩层二维码）
                    string qrcodeuri = "/allqrcode/code/" + userInfo.inviteKey + ".jpg";
                    sbBody.AppendLine("          <div id='js-share-guide' class='js-fullguide fullscreen-guide hide' style='font-size: 20px; line-height: 30px; color: #fff; text-align: center;'>");
                    sbBody.AppendLine("            <span class='js-close-guide guide-close'>&times;</span>");
                    sbBody.AppendLine("            <div class='guide-inner'>");
                    sbBody.AppendLine("                通过微信【扫一扫】功能");
                    sbBody.AppendLine("                <br />扫描二维码关注我们");
                    sbBody.AppendLine("                <img style='width:160px; height: 160px;margin-top: 20px;' src='" + qrcodeuri + "' />");
                    sbBody.AppendLine("            </div>");
                    sbBody.AppendLine("         </div>");


                    //页面搜索条
                    //sbBody.AppendLine("        <div class='search-bar' style='display: none;'>");
                    //sbBody.AppendLine("            <form class='search-form' action='http://wap.koudaitong.com/v2/search'");
                    //sbBody.AppendLine("            method='GET'>");
                    //sbBody.AppendLine("                <input class='search-input' placeholder='搜索本店所有商品' name='q' value='' type='search'>");
                    //sbBody.AppendLine("                <input name='kdt_id' value='384' type='hidden'>");
                    //sbBody.AppendLine("                <a class='js-search-cancel search-cancel' href='javascript:;'>");
                    //sbBody.AppendLine("                    取消");
                    //sbBody.AppendLine("                </a>");
                    //sbBody.AppendLine("                <span class='search-icon'>");
                    //sbBody.AppendLine("                </span>");
                    //sbBody.AppendLine("                <span class='close-icon hide'>");
                    //sbBody.AppendLine("                </span>");
                    //sbBody.AppendLine("            </form>");
                    //sbBody.AppendLine("            <div class='history-wrap center'>");
                    //sbBody.AppendLine("                <ul class='history-list search-recom-list js-history-list clearfix'>");
                    //sbBody.AppendLine("                </ul>");
                    //sbBody.AppendLine("                <a class='tag tag-clear js-tag-clear c-gray-darker hide' href='javascript:;'>");
                    //sbBody.AppendLine("                    清除历史搜索");
                    //sbBody.AppendLine("                </a>");
                    //sbBody.AppendLine("            </div>");
                    //sbBody.AppendLine("        </div>");
                    sbBody.AppendLine("");

                    //页面工具
                    //sbBody.AppendLine("        <div id='right-icon' class='js-right-icon no-text'>");
                    //sbBody.AppendLine("            <div style='width: 50px;' class='js-right-icon-container right-icon-container clearfix'>");
                    //sbBody.AppendLine("                <a id='global-cart' href='http://wap.koudaitong.com/v2/trade/cart?kdt_id=384'");
                    //sbBody.AppendLine("                class='icon hide s0' style=''>");
                    //sbBody.AppendLine("                    <p class='icon-img'>");
                    //sbBody.AppendLine("                    </p>");
                    //sbBody.AppendLine("                    <p class='icon-txt'>");
                    //sbBody.AppendLine("                        购物车");
                    //sbBody.AppendLine("                    </p>");
                    //sbBody.AppendLine("                </a>");
                    //sbBody.AppendLine("                <a id='global-wish' href='http://trade.koudaitong.com/wxpay/wish?kdt_id=384'");
                    //sbBody.AppendLine("                class='icon'>");
                    //sbBody.AppendLine("                    <p class='icon-img'>");
                    //sbBody.AppendLine("                    </p>");
                    //sbBody.AppendLine("                    <p class='icon-txt'>");
                    //sbBody.AppendLine("                        心愿单");
                    //sbBody.AppendLine("                    </p>");
                    //sbBody.AppendLine("                </a>");
                    //sbBody.AppendLine("                <a class='js-show-more-btn icon show-more-btn hide'>");
                    //sbBody.AppendLine("                </a>");
                    //sbBody.AppendLine("            </div>");
                    //sbBody.AppendLine("        </div>");
                    //sbBody.AppendLine("    </body>");

                    htmlMsg = sbBody.ToString();
                }
            }
            return htmlMsg;
        }
    }
}
